<?php
	$path_one = 'admin/admin_project';
	$path_two = 'admin/admin_project_address';
	$filename = 'admin/device_workplace_list';
	require_once("header.php");
	require_once("admin_comm.php");
	require_once $_site->get_handlepath('project');
	$page=request('page',false,true,false,1);
	$pagesize=request('pagesize',false,true,false,10);
	$data['pid']=request('pid',false,true,false,0);
	$data['state']=request('state',false,true,false,0);
	$no_title=request('no_title');
	$result = project_fun_get_project_device_list($data,$page,$pagesize);
	$hover[$data['state']]=' class="hover" ';

?>
<script type="text/javascript" charset="utf-8">

	loader.file({
		plugin:['validform/main','dialog/main'],
		skincss:['list']
	})
	function get_project_info (){
		dialog.iframe({
			title:'项目选择',
			is_resize:false,
			top:{
				is_show:true,
				btn_max:false,
				btn_min:false,
				btn_close:true,
				height:33,
				is_move:true
			},
			is_scroll:false,
			min_width:350,
			min_height:500,
			is_center:true,
			is_lock_back:false,
			content:'/admin/common_choise?callback=set_project_info&parm=state.1',
			name:'choise_project'
		});
	}

	function set_project_info(id,title){
		if(id && title){
			$("#pid").val(id);
			$("#name_title").val(title);
		}
	}

</script>
</head>
<body>
	<div class="position_nav">你所在的当前位置：<?php echo $path_str;?></div>
		<div class="main">

			<div class="sos_box">
				<form action="/admin/device_workplace_list" id="search" method='get'>
					<span>选择项目：</span>
						<input type="hidden" name="pid" id='pid' value="<?php echo $data['pid'] ;?>">
						<input type="text" name='no_title' id='name_title' readonly="readonly" value="<?php echo $no_title ;?>" onclick='get_project_info();'>

					<input class="button1" type="submit" value="搜索">
				</form>
			</div>
			<div class="power_nav">
				<ul>
					<li <?php echo $hover[0] ;?>>
						<a href="/admin/device_workplace_list?state=0&<?php echo preg_replace('/(&page=\d*)|(&state=\d*)|(&v=\w+\/\w+)/','',$_SERVER['QUERY_STRING']) ;?>">全部</a>
					</li>
					<li <?php echo $hover[1] ;?>>
						<a href="/admin/device_workplace_list?state=1&<?php echo preg_replace('/(&page=\d*)|(&state=\d*)|(&v=\w+\/\w+)/','',$_SERVER['QUERY_STRING']) ;?>">已绑定</a>
					</li>
					<li<?php echo $hover[2] ;?>>
						<a href="/admin/device_workplace_list?state=2&<?php echo preg_replace('/(&page=\d*)|(&state=\d*)|(&v=\w+\/\w+)/','',$_SERVER['QUERY_STRING']) ;?>">未绑定（已解绑）</a>
					</li>
				</ul>
			</div>
			<table cellpadding="0" cellspacing="1" border="0" class="table">
				<tr>
					<th align="center">序号</th>
					<th align="left">所属项目</th>
					<th align="left">设备号</th>
					<th align="center">绑定状态</th>
					<th align="left">联系人</th>
					<th align="center">联系电话</th>
				</tr>
				<?php
					if($result['rows']){
						foreach ($result['rows'] as $v){
							?>
							<tr>
								<td align="center"><?php echo $v['id'] ;?></td>
								<td align="left"><?php echo $v['title'] ;?></td>
								<td align="left"><?php echo $v['no'] ;?></td>
								<td align="center"><?php echo $v['state']=='1'?"<span style='color:#666666;'>已绑定</span>":"<span style='color:#ff8400;'>已解绑</span>" ;?></td>
								<td align="left"><?php echo $v['linkman'] ;?></td>
								<td align="center"><?php echo $v['phone'] ;?></td>

							</tr>
							<?php
						}
					}else{
						?>
						<tr>
							<td colspan="8">暂无数据！</td>
						</tr>
						<?php
					}
				?>
				<tr>
					<td colspan="8">
						<div class="list_more">
							项目总数：<?php echo $result['row_count']?$result['row_count']:0 ;?>
							<?php
								echo page_method($result['row_count'], $page, $result['page_count'], 10, '?'.preg_replace('/(&page=\d*)/','',$_SERVER['QUERY_STRING']), false);
							?>
						</div>
					</td>
				</tr>
			</table>
		</div>
	</div>
</body>
</html>


